Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run puffin and puffin_egui on wasm32 on web #112

Merged
merged 6 commits into from
Dec 9, 2022
Merged

Conversation

emilk
Copy link
Collaborator

@emilk emilk commented Dec 6, 2022

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

This makes puffin and puffin_egui compile and run on wasm32 compiled for web if you enable the "web" feature.

The timer resolution on web sucks - it is only 1 ms due to meltdown/spectre mitigation, but having the same code compile and run on both native and web is quite nice regardless.

I tested this by quickly hacking in to my eframe_template project, and it works!

@emilk emilk requested a review from TimonPost as a code owner December 6, 2022 14:14
puffin/Cargo.toml Outdated Show resolved Hide resolved
puffin/src/lib.rs Outdated Show resolved Hide resolved
@emilk emilk requested a review from repi December 6, 2022 19:49
puffin_egui/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@repi repi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimonPost before approving and merging this, could you try it out on one of our wasm modules and verify it still compiles and works - just be to safe?

Copy link
Member

@TimonPost TimonPost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could compile it for wasm-unknown-unknown, nice fix!

@repi
Copy link
Contributor

repi commented Dec 7, 2022

Could compile it for wasm-unknown-unknown, nice fix!

do you mean you tested it for one of our modules and saw that it worked in practice with profiling and what dependencies it added, or that you compiled puffin here for just wasm32-unknown-unknown? the latter is in no doubt :)

@TimonPost
Copy link
Member

Added it as a dependency, checked what deps it added with introduced feature flags, and validated our modules compile with the new dependencies. Which was the first part of the suggestion, tho the second 'working' part needs some more work. I will have to take some more time to validate that.

@TimonPost
Copy link
Member

TimonPost commented Dec 9, 2022

Seems to still run fine :)

@TimonPost TimonPost merged commit b533707 into main Dec 9, 2022
@TimonPost TimonPost deleted the emilk/web-support branch December 9, 2022 12:00
repi added a commit that referenced this pull request Jul 1, 2023
This dependency was introduced originally in #112.

It is a platform abstraction, but it is a tiny one and it is not harder to just use the std type which avoids always pulling in `instant` including for `wasm32-unknown-unknown` when not building for the web where it has no purpose at all.

Want to have as few dependencies as possible on core low level crates like `puffin` that almost all of our code depends on.
emilk added a commit that referenced this pull request Sep 4, 2023
This dependency was introduced originally in #112.

It is a platform abstraction, but it is a tiny one and it is not harder
to just use the std type which avoids always pulling in `instant`
including for `wasm32-unknown-unknown` when not building for the web
where it has no purpose at all.

Want to have as few dependencies as possible on core low level crates
like `puffin` that almost all of our code depends on.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
plasticbox pushed a commit to alt9github/puffin that referenced this pull request Nov 9, 2023
)

This dependency was introduced originally in EmbarkStudios#112.

It is a platform abstraction, but it is a tiny one and it is not harder
to just use the std type which avoids always pulling in `instant`
including for `wasm32-unknown-unknown` when not building for the web
where it has no purpose at all.

Want to have as few dependencies as possible on core low level crates
like `puffin` that almost all of our code depends on.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants